package com.ybliang.plat.cms.service.impl;

import com.ybliang.plat.cms.feign.UserFeignClient;
import com.ybliang.plat.cms.mapper.AdvertisementMapper;
import com.ybliang.plat.cms.model.AdvertisementModel;
import com.ybliang.plat.cms.service.AdvertisementService;
import com.ybliang.plat.common.data.vo.resp.Resp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class AdvertisementServiceImpl implements AdvertisementService {

    public static Logger LOGGER = LoggerFactory.getLogger(AdvertisementServiceImpl.class);

    @Autowired
    AdvertisementMapper advertisementMapper;

//    @Autowired
//    UserService userService;

    @Autowired
    UserFeignClient userFeignClient;

    @Override
    public AdvertisementModel getById(Long id) {
        return null;
    }

    @Override
    public List<AdvertisementModel> getAdvertisementList(Integer type) {
        LOGGER.info("getAdvertisementList type:{}", type);
        List<AdvertisementModel> ads = advertisementMapper.findByType(type);
//        if(ads.size() > 0){
//            throw new BusinessException(ErrorCode.CMS_SEARCH_EXCEPTION);
//        }
//        UserModel user = userService.findByMobile("17688705466");
        Resp resp = userFeignClient.info();
        userFeignClient.findByMobile("17688705466");
        return ads;
    }
}
